<template>
  <div v-for="(item, index) in pdfList" :key="item.id">
    <van-button type="primary" @click="viewPdf(item.pdfUrl)">预览pdf按钮</van-button>
  </div>
</template>

<script  setup>
import { ref, reactive } from 'vue'
import { useRouter } from "vue-router";
const router = useRouter()
let pdfList = ref([
  {
    id: 1,
    pdfUrl: 'https://a.data96.com/pdf_preview/upload/%E4%B8%AD%E6%96%87.pdf'
  },
  {
    id: 2,
    pdfUrl:'https://wwwimages2.adobe.com/content/dam/cc/cn/legal/servicetou/Acrobat-Sign-Additional-Terms-of-Use-zh_CN-20231015.pdf'

  }
])

const viewPdf = (pdf) => {
  router.push({
    path: '/pdf',
    query: {
      pdfUrl: pdf
    }
  })

}
</script>
<style lang="scss" scoped></style>